import React from 'react';
import propsType from 'prop-types';
import './button.less';

interface Props {
  onClick?: Function;
  className?: String;
  disabled?: Boolean;
  children?: any;
  type?: String;
  gray?: boolean; // 是否可以点击- 灰色
}
export default function Button(props: Props) {
  const { disabled, className, onClick, type, gray } = props;

  if (type === undefined) {
    return (
      <div className={`c-button primary ${disabled ? 'disabled' : ''} ${className} ${gray ? 'gray' : ''}`} onClick={() => (onClick as Function)()}>
        {props.children}
      </div>
    );
  }
  return (
    <div className={`c-button ${disabled ? 'disabled' : ''} ${className}`} onClick={() => (onClick as Function)()}>
      {props.children}
    </div>
  );
}

Button.defaultProps = {
  onClick: () => {},
};
